<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li v-for="(v, i) in arr" :key="i" :class="{ completed: v.isDone }">
      <div class="view">
        <input class="toggle" type="checkbox" v-model="v.isDone" />
        <label>{{ v.name }}</label>
        <button class="destroy" @click="del(i)"></button>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  props: ["arr"],
  methods: {
    del(index) {
      this.$emit("delete", index);
    },
  },
};
</script>